/** 属性组件 */
import { Form, Input } from "antd";
import { FC } from "react";
import { questionInput_propsType } from ".";

const PropsComponent: FC<questionInput_propsType> = (props) => {
    const { title, placeholder, onchange,islock = false } = props
    const [form] = Form.useForm();
    const valueChange = ()=>{
        if(onchange){
            onchange(form.getFieldsValue())
        }
    }
    return <Form 
        layout='vertical' 
        form={form} 
        initialValues={{ title, placeholder }}
        onValuesChange = {valueChange}
        disabled = {islock}
        >
            <Form.Item label="标题" name="title">
                <Input placeholder="请输入" value={title} />
            </Form.Item>
            <Form.Item label="placeholder" name="placeholder">
                <Input placeholder="请输入" value={placeholder} />
            </Form.Item>
    </Form>
}

export default PropsComponent